#include "./../inc/main.h"

monster_Node_p monsterInit()
{
    monster_Node_p head = Node_create();
    monster_Node_p newNode = Node_create();
    strcpy(newNode->data->monster_name, "史莱姆");
    newNode->data->LV = 1;
    newNode->data->HP = 3;
    newNode->data->ATK = 2;
    newNode->data->DEF = 1;
    newNode->data->gold = 1;
    newNode->data->object = 31;

    head->next = newNode;
    newNode->next = NULL;

    monster_Node_p newNode2 = Node_create();
    strcpy(newNode2->data->monster_name, "骷髅队长");
    newNode2->data->LV = 1;
    newNode2->data->HP = 10;
    newNode2->data->ATK = 2;
    newNode2->data->DEF = 1;
    newNode2->data->gold = 1;
    newNode2->data->object = 71;
    newNode->next = newNode2;
    newNode2->next = NULL;

    return head;
}

monster_Node_p Node_create()
{
    monster_Node_p currNode = (monster_Node_p)malloc(sizeof(monster_Node_t));
    monster_p data = (monster_p)malloc(sizeof(monster_t));
    currNode->data = data;
    currNode->next = NULL;
    return currNode;
}

monster_Node_p find_monster(int map_info)
{
    monster_Node_p p = monster_head->next;
    while (p != NULL)
    {
        if (p->data->object == map_info)
        {
            return p;
        }
        p = p->next;
    }
    return NULL;
}
